package com.teamide.util;

public class ObjectUtil {

	public static boolean isNull(Object obj) {

		return obj == null;
	}

	public static boolean isNotNull(Object obj) {

		return false == isNull(obj);
	}

	public static boolean isTrue(Object obj) {

		if (isNull(obj)) {
			return false;
		}
		return Boolean.valueOf(String.valueOf(obj));
	}

	/**
	 * 判断obj是否为基本类型
	 * 
	 * @param obj
	 * @return boolean 是否是基础类型
	 */
	public static boolean isBaseType(Object obj) {
		if (obj == null) {
			return false;
		}
		Class<?> className = obj.getClass();
		if (className.equals(java.lang.Integer.class) || className.equals(java.lang.Byte.class)
				|| className.equals(java.lang.Long.class) || className.equals(java.lang.Double.class)
				|| className.equals(java.lang.Float.class) || className.equals(java.lang.Character.class)
				|| className.equals(java.lang.Short.class) || className.equals(java.lang.Boolean.class)) {
			return true;
		}
		return false;
	}
}
